package com.rover.system.service;

import com.grid.DataGrid;
import com.grid.Page;
import com.rover.system.entity.Attachment;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 13-9-21
 * Time: 下午2:21
 * To change this template use File | Settings | File Templates.
 */
@Service("attachmentService")
@Transactional
public class AttachmentService extends BaseService {
    @Override
    public <T> DataGrid query(Page page) throws Exception {
            page.setWhere("businessKey='"+page.getParameter("businessKey")+"'");
        DataGrid dataGrid = new DataGrid();
        List<Attachment> li = dao.<Attachment>findPageHql(page.getHQL(), page.getWhereParams(), page.getPageNo(),
                page.getPageSize());
        dataGrid.setResult(li);
        dataGrid.setTotalCount(dao.countHql(page.getHQLTotalCount(), page.getWhereParams()));
        return dataGrid;

    }
}
